package com.xiaofei.threadpool;

import java.util.Vector;

public class Main {

	public static void main(String[] args) {
		ThreadPool pool = ThreadPool.getInstance();
		Vector<Thread>threads = new Vector<>();
		for(int i=0;i<1000;i++){
			pool.execute(new Runnable() {
				
				@Override
				public void run() {
					threads.add(Thread.currentThread());
					System.out.println(Thread.currentThread().getId());					
				}
			});
		}
		System.out.println(pool.getThreadCount());
		try {
			Thread.sleep(10);
		} catch (Exception e) {
			// TODO: handle exception
		}
		System.out.println("=====================stopping thread=======================");
		pool.shutdown();
		for(Thread thread:threads){
			if(thread.getState()==Thread.State.WAITING){
				System.out.println(thread.getName()+" "+thread.getState());
			}
		}
	}

}
